package com.chao.error;

public class BusinessException extends Exception implements CommonError {

    private CommonError commonError;

    public BusinessException(CommonError commonError){
        this.commonError = commonError;
    }

    public BusinessException(CommonError commonError, String message){
        this.commonError = commonError;
        this.commonError.setErrorMessage(message);
    }

    @Override
    public int getErrorCode() {
        return commonError.getErrorCode();
    }

    @Override
    public String getErrorMessage() {
        return commonError.getErrorMessage();
    }

    @Override
    public CommonError setErrorMessage(String message) {
        return commonError.setErrorMessage(message);
    }
}
